package thread;

public class SleepDemo {
    public static void main(String[] args) {
        Thread t1,t2,t3;

        Run run = new Run();

        t1 = new Thread(run);
        t2 = new Thread(run);
        t3 = new Thread(run);

        t1.setPriority(Thread.MIN_PRIORITY);
        t2.setPriority(Thread.MAX_PRIORITY);
        t3.setPriority(Thread.NORM_PRIORITY);


        t1.start();
        t2.start();
        t3.start();



    }

    private static class Run implements Runnable{
        Thread t;
        public Run(){};

        public void run(){

            for (int i = 0; i < 5000; i++) {
                t = Thread.currentThread();
                System.out.println("我是" + t.getName());
                try {
                    Thread.sleep(0);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(t.getName() + "执行完毕");
            }
            System.out.println(t.getName() + "结束了");
        }
    }
}
